﻿<Window x:Class="Pairs.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Pairs"
        Title="MainWindow" MaxHeight="700" MinHeight="700" MaxWidth="800" MinWidth="800" Icon="/Memory;component/Nessy.ico" WindowStartupLocation="CenterScreen">
    <Window.CommandBindings>
        <CommandBinding Command="{x:Static local:GameCommands.NewGameSinglePlayer}" Executed="NewGameSinglePlayerCommand_Executed"></CommandBinding>
        <CommandBinding Command="{x:Static local:GameCommands.NewGameTwoPlayer}" Executed="NewGameTwoPlayerCommand_Executed"></CommandBinding>
        <CommandBinding Command="{x:Static local:GameCommands.NewGameAgainstComputer}" Executed="NewGameAgainstComputerCommand_Executred"></CommandBinding>
        <CommandBinding Command="{x:Static local:GameCommands.Options}" Executed="OptionsCommand_Executed"></CommandBinding>
    </Window.CommandBindings>
    <Window.Resources>
        <Style x:Key="RectangleStyle">
            <Setter Property="Rectangle.RadiusX" Value="10"/>
            <Setter Property="Rectangle.RadiusY" Value="10"/>
            <Setter Property="Rectangle.Margin" Value="5"/>
            <EventSetter Event="Rectangle.MouseLeftButtonUp" Handler="rectangleLeftMouseButtonUp"></EventSetter>
        </Style>
        <Style x:Key="BorderStyle">
            <Setter Property="Border.BorderBrush" Value="LightBlue"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsActive}" Value="True">
                    <Setter Property="Border.BorderBrush" Value="Red"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="StackPanelStyle">
            <Setter Property="StackPanel.Background" Value="LightBlue"></Setter>
            <Setter Property="DockPanel.Dock" Value="Left"></Setter>
            <Style.Triggers>
                <Trigger Property="StackPanel.DataContext" Value="{x:Null}">
                    <Setter Property="StackPanel.Visibility" Value="Collapsed"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="Game">
                <MenuItem Command="local:GameCommands.NewGameSinglePlayer"></MenuItem>
                <MenuItem Command="local:GameCommands.NewGameTwoPlayer"></MenuItem>
                <MenuItem Command="local:GameCommands.NewGameAgainstComputer"></MenuItem>
                <Separator></Separator>
                <MenuItem Command="local:GameCommands.Options"></MenuItem>
                <Separator></Separator>
                <MenuItem Header="Exit"></MenuItem>
            </MenuItem>
            <MenuItem Header="?"></MenuItem>
        </Menu>

        <StatusBar DockPanel.Dock="Bottom">
            <StatusBarItem>
            <TextBlock>Time Left:</TextBlock>
            </StatusBarItem>
            <StatusBarItem HorizontalContentAlignment="Stretch">
            <ProgressBar x:Name="progressBarTimeLeft" Height="20" Maximum="200" Value="200"></ProgressBar>
            </StatusBarItem>
        </StatusBar>
        
        <!-- Player 1 Scores-->
        <Border x:Name="borderPlayer1" BorderThickness="3" Style="{StaticResource ResourceKey=BorderStyle}">
        <StackPanel x:Name="stackPanelPlayer1" Style="{StaticResource ResourceKey=StackPanelStyle}">
            <TextBlock Text="{Binding Name}"></TextBlock>
            <local:ScoreControl x:Name="player1ScoreControl" Score="{Binding Path=Score}"/>
        </StackPanel>
        </Border>
        
        <!-- Player 2 Scores-->
        <Border x:Name="borderPlayer2" BorderThickness="3" Style="{StaticResource ResourceKey=BorderStyle}">
            <StackPanel x:Name="stackPanelPlayer2" Style="{StaticResource ResourceKey=StackPanelStyle}">
                <TextBlock Text="{Binding Name}"></TextBlock>
                <local:ScoreControl x:Name="player2ScoreControl" Score="{Binding Path=Score}"></local:ScoreControl>
            </StackPanel>
        </Border>


        <Grid x:Name="gameGrid" DockPanel.Dock="Left" ShowGridLines="False" Background="LightBlue">
            
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <!-- First Row-->


            <Rectangle 
                
                Grid.Row="0" Grid.Column="0"
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />
                
            <Rectangle 
                Grid.Row="0" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="0" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="0" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="0" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="0" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />
            
            <!-- Second Row-->

            <Rectangle 
                Grid.Row="1" Grid.Column="0" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="1" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="1" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="1" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="1" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="1" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <!-- Third Row-->

            <Rectangle 
                Grid.Row="2" Grid.Column="0" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="2" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="2" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="2" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="2" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="2" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <!-- Fourth Row-->

            <Rectangle 
                Grid.Row="3" Grid.Column="0" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="3" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="3" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="3" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="3" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="3" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <!-- Fifth Row-->

            <Rectangle 
                Grid.Row="4" Grid.Column="0" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="4" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="4" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="4" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="4" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="4" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <!-- Sixth Row-->

            <Rectangle 
                Grid.Row="5" Grid.Column="0" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="5" Grid.Column="1" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="5" Grid.Column="2" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="5" Grid.Column="3" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="5" Grid.Column="4" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

            <Rectangle 
                Grid.Row="5" Grid.Column="5" 
                Fill="{Binding Path=ActiveImage}"
                Style="{StaticResource ResourceKey=RectangleStyle}"
             />

        </Grid>

    </DockPanel>
</Window>
